Skip to content

feat(tool-images): add a Rust tool image with cross-compilation tools - #274

Merged
Mearman merged 1 commit into
mainfrom
feat/rust-tool-image
Nov 26, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/rust-tool-image

Conversation

@Mearman

@Mearman Mearman commented Nov 26, 2026

Copy link
Copy Markdown
Member

Adds tool-images/rust, a tool-cache capability image for linux/amd64 and linux/arm64, so jobs that build Rust get a pinned toolchain with no per-job install: Rust 1.100.0 (rustfmt, clippy, and the standard libraries of both macOS, both Linux musl and both Windows gnullvm targets), Zig 0.17.1, cargo-zigbuild 0.24.1 and cargo-deny 0.22.1. The ARC role README's new Rust tool image section says how to declare it.

Two things differ from the other tool images.

The zig on PATH is a short script. rustc links gnullvm targets with -nolibc --unwindlib=libunwind and leaves the driver to add the library; Zig 0.17 ignores --unwindlib, and cargo-zigbuild asks for compiler-rt (rust-cross/cargo-zigbuild#439) but not libunwind, so every Windows link failed with undefined _Unwind_* symbols. The script adds -lunwind to those links, which also makes llvm-mingw unnecessary.

The tag is <Rust release>-r<revision>, because the other pins can change while the Rust release does not and a published tag is never rebuilt. The Rust toolchain workflow fails a pull request that changes the image under the same tag.

That workflow builds the image natively on both architectures, fills a tool cache as the role's init container does, runs the role's job-started hook in the build runner image, cross-compiles a crate with a C source for every target and reads each executable's headers: an Apple one may load nothing outside /usr/lib, a Linux one must be static, and each must be for its processor.

Closes #273

A tool-cache image for linux/amd64 and linux/arm64 holding a pinned
stable Rust toolchain with rustfmt, clippy and the standard libraries of
the macOS, Linux musl and Windows gnullvm targets, and Zig,
cargo-zigbuild and cargo-deny, each checked against its published
checksum. It holds no Apple SDK and nothing of Microsoft's.

Its zig adds -lunwind to a link that asks for LLVM's libunwind, which
zig cc ignores and cargo-zigbuild does not translate, so the gnullvm
targets link.

The published tag is the Rust release followed by an image revision,
since the other pins can change while the release does not.

A workflow builds the image on both architectures, cross-compiles a crate
with a C source for every target, checks each executable's headers (an
Apple one loads nothing outside /usr/lib) and fails a change to the image
that keeps its tag.

Closes #273
@Mearman
Mearman marked this pull request as ready for review November 26, 2026 17:18
@Mearman
Mearman merged commit 04418fe into main Nov 26, 2026
24 checks passed
@Mearman
Mearman deleted the feat/rust-tool-image branch November 26, 2026 17:18
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Rust tool image with cross-compilation tools

1 participant